package com.NeuglsWorkStudio.UI.FormElement.Component
{
	import com.NeuglsWorkStudio.Colors.ColorUtility;
	import com.NeuglsWorkStudio.UI.FormElement.Config.TBorderButtonConfig;
	import com.NeuglsWorkStudio.UI.FormElement.Config.TConfig;
	
	import flash.filters.DropShadowFilter;
	
	/**
	 * 带边框的按钮
	 * @author Neugls
	 * */
	public class TBorderButton extends TCustomButton
	{
		public static var ButtonWidth:Number=80;
		public static var ButtonHeight:Number=20;
		
		public function TBorderButton(AConfig:TConfig)
		{
			super(AConfig);
		}
		
		override protected function Init():void{
			this.HoverItemConfig().DisplayIcon=false;
			this.HoverItemConfig().NormalFontColor=ColorUtility.GetColorFromBaseColor(BorderButtonConfig().BaseColor);
			this._FConfig.Width=ButtonWidth;
			this._FConfig.Height=ButtonHeight;
			super.Init();
		}
		
		public function BorderButtonConfig():TBorderButtonConfig{
			return _FConfig as TBorderButtonConfig;
		}
		
		override protected function DrawMouseOver():void{
			with(this._FBack.graphics){
				clear();
				lineStyle(1,ColorUtility.GetBorderColorFromBaseColor(BorderButtonConfig().BaseColor));
				beginFill(ColorUtility.GetBackColorFromBaseColor(BorderButtonConfig().BaseColor),0.7);
				drawRect(0,0,this.Width,BorderButtonConfig().Height);
				endFill();
			}
		}
		
		override protected function DrawNormal():void{
			var BorderWidth:Number=2;
			with(this._FBack.graphics){
				clear();
				lineStyle(BorderWidth,ColorUtility.GetBorderColorFromBaseColor(BorderButtonConfig().BaseColor));
				beginFill(BorderButtonConfig().BaseColor,0);
				drawRect(0,0,this.Width,BorderButtonConfig().Height);
				endFill();
			}
		}
		
		override protected function DrawIconAndLabel():void{
			with(this._FLabel){
				x=(Width-width)/2;
				y=(this.height-height)/2;
			}
		}
	}
}